All Questions
9 questions
1vote
1answer
192views
Is it an acceptable pattern to put derived classes inside an abstract base class in Java?
Suppose I have some Java code such as the following (in this case, the use of the name "interaction" is referring to interacting with an object in a video game): public abstract class ...
1vote
4answers
1kviews
Pattern / solution for Boolean decision making chains
I need a solution for decision making chain. There are number of criteria that may return true, false or be inconclusive. A non-functional code (Java) would look like this: Boolean res = ...
0votes
2answers
181views
How to write the following snippet in more cleaner way?
When the caller gives me a call, I need to evaluate n number of criteria which currently I'm doing like if (a & b & c & d & e) Day by day the conditions are growing and it's ...
4votes
1answer
745views
Design pattern to instantiate implementations depending on properties
I have an interface: public interface MyInterface{} And two implementations: public class Imp1 implements MyInterface {} public class Imp2 implements MyInterface {} My program is a CLI. I want to ...
0votes
3answers
30kviews
How to design the classes for a simple shopping cart example using Strategy Design Patterns
First year of Software Engineering, and we're learning OOP within Java. Came across an extension task to gain more credits. But could not think of what to do: First Step: Design a checkout system ...
2votes
2answers
2kviews
Joshua Bloch Enum Singleton and Third Party APIs
In the book Effective Java he give the best Singleton pattern implementation in his, that is implement by a Enum. I have doubt to how to implement this pattern with a third party API. I'm using an ...
6votes
1answer
2kviews
Which patterns/architecture to apply for "Import Data, Process Data, Export Result"
I was wondering which architecture/patterns to choose for the following problem divided into three steps: Import TestScript Description from File (e.g. .xls, .txt) Process Described TestScript Export ...
0votes
1answer
83views
How to record/store edits?
In many programs and web apps (stack exchange included) the program is able to backtrack what edits where made to the piece. My issue is similar: I want to be able to store a "timeline" of edits, ...
8votes
2answers
324views
Low coupling processing big quantities of data
Usually I achieve low coupling by creating classes that exchange lists, sets, and maps between them. Now I am developing a Java batch application and I can't put all the data inside a data structure ...